home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_force_persuasion.cog < prev    next >
Text File  |  1998-02-25  |  4KB  |  162 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # FORCE_PERSUASION.COG
  4. #
  5. # FORCEPOWER Script - Persuasion
  6. #  Light Side Power
  7. #  Bin 26
  8. #
  9. # [YB]
  10. #
  11. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  12.  
  13.  
  14. symbols
  15.  
  16. thing       player                           local
  17.  
  18. flex        mana                             local
  19. flex        cost=250.0                       local
  20. int         rank                             local
  21.  
  22. sound       persuasionSound=ForcePersuas01.WAV  local
  23. sound       persuasionSound2=ForcePersuas02.WAV local
  24. int         channel=-1                       local
  25.  
  26. int         inbubble=0                       local
  27.  
  28. message     startup
  29. message     activated
  30. message     timer
  31. message     pulse
  32. message     newplayer
  33. message     killed
  34. message     selected
  35. message     enterbubble
  36. message     exitbubble
  37.  
  38. end
  39.  
  40. # ========================================================================================
  41.  
  42. code
  43.  
  44. startup:
  45.    player = GetLocalPlayerThing();
  46.    inbubble = 0;
  47.    call stop_power;
  48.  
  49.    Return;
  50.  
  51. # ........................................................................................
  52.  
  53. activated:
  54.    if(inbubble) Return;
  55.  
  56.    if(!IsInvActivated(player, 26))
  57.    {
  58.       mana = GetInv(player, 14);
  59.       if(mana >= cost || GetInv(player, 14) >= GetInv(player, 69))
  60.       {
  61.          if(GetInv(player, 64) != 1) ChangeInv(player, 14, -cost);
  62.  
  63.          // Send a "force disturbance"...
  64.          if(!IsMulti())
  65.             SendMessageExRadius(GetThingPos(player), cost, 0x4, splash, 26, 0, 0, 0);
  66.  
  67.          SetInvActivated(player, 26, 1);
  68.  
  69.          PlayMode(player, 24);
  70.  
  71.          // Play activation sound
  72.          PlaySoundThing(persuasionSound, player, 1.0, -1, -1, 0x80);
  73.  
  74.          // Play loop sound at 0.0 volume and fade it in to 1.0 volume in 0.75 secs
  75.          channel = PlaySoundThing(persuasionSound2, player, 0.0, -1, -1, 0x81);
  76.          ChangeSoundVol(channel, 1.0, 0.75);
  77.  
  78.          rank = GetInv(player, 26);
  79.          SetTimerEx(rank * 10, 1, 0, 0);
  80.  
  81.          // Set player invisible to AI
  82.          SetActorFlags(player, 0x80);
  83.  
  84.          // Set player "invisible" to real players
  85.          if(rank == 1) jkSetPersuasionInfo(player, 14, 22);
  86.          else if(rank == 2) jkSetPersuasionInfo(player, 11, 19);
  87.          else if(rank == 3) jkSetPersuasionInfo(player, 8, 16);
  88.          else if(rank == 4) jkSetPersuasionInfo(player, 5, 13);
  89.  
  90.          SetThingCurGeoMode(player, 0);
  91.          jkSetFlags(player, 0x20);
  92.  
  93.          SetPulse(0.5);
  94.       }
  95.    }
  96.  
  97.    Return;
  98.  
  99. # ........................................................................................
  100.  
  101. timer:
  102.    call stop_power;
  103.  
  104.    Return;
  105.  
  106. # ........................................................................................
  107.  
  108. pulse:
  109.    if(GetThingHealth(player) < 1) call stop_power;
  110.  
  111.    Return;
  112.  
  113. # ........................................................................................
  114.  
  115. selected:
  116.    jkPrintUNIString(player, 26);
  117.    Return;
  118.  
  119. # ........................................................................................
  120.  
  121. killed:
  122.    if(GetSenderRef() != player) Return;
  123.  
  124. newplayer:
  125.    call stop_power;
  126.  
  127.    Return;
  128.  
  129. # ........................................................................................
  130.  
  131. enterbubble:
  132.    inbubble = 1;
  133.    call stop_power;
  134.    Return;
  135.  
  136. # ........................................................................................
  137.  
  138. exitbubble:
  139.    inbubble = 0;
  140.    Return;
  141.  
  142. # ........................................................................................
  143.  
  144. stop_power:
  145.    SetPulse(0);
  146.    KillTimerEx(1);
  147.    if(channel != -1)
  148.    {
  149.       StopSound(channel, 0.1);
  150.       channel = -1;
  151.    }
  152.    SetInvActivated(player, 26, 0);
  153.    ClearActorFlags(player, 0x80);
  154.    SetThingCurGeoMode(player, GetThingGeoMode(player));
  155.    jkClearFlags(player, 0x20);
  156.  
  157.    Return;
  158.  
  159. end
  160.  
  161.  
  162.